package com.vframework.common.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.vframework.base.controller.BaseController;
import com.vframework.common.constant.SessionConstant;
import com.vframework.common.model.RegionsBean;
import com.vframework.common.service.DictService;

/***************************************************************
 * Name:        CommonAction.java     
 * Create At:   2010-04-22
 * Module:      系统公共模块Action
 * Description: [系统公共模块]
 * Author       shanzhitong
 * ------------------------------------------------------------
 * 修改历史
 * 序号  日期  修改人   修改原因
 * 1
 * 2
***************************************************************/
@Controller
@RequestMapping("common")
public class CommonController extends BaseController {

	/**
	 * Author:shanzhitong
     * Create At:2010-06-22
     * Description: [公共方法-省联动市]
     * @return String
	 * @throws Exception 
     */
	@RequestMapping("getCityList")
	@ResponseBody
    public List<RegionsBean> getCityList(HttpServletResponse resp,HttpServletRequest req) throws Exception {
		String pcode = (String)super.paramMap.get("param_pcode");
		
		String userType = (String)super.session.getAttribute(SessionConstant.SESSION_USER_TYPE);
		String cityCode = null;
		//市级管理员只能显示本市的数据
		if("2".equals(userType)){
			cityCode = (String)super.session.getAttribute(SessionConstant.SESSION_USER_CITY_CODE);
		}
		List<RegionsBean> list = DictService.getCityList(pcode,cityCode);//获取数据
		return list;//输出数据
	}
	
}
